<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="">
        <meta name="author" content="">

        <link rel="shortcut icon" href="<!--{eval echo register_static('img/touch-icon-57x57.png');}-->">

        <title>粉粉管理系统</title>

        <!-- Bootstrap core CSS -->
        <link href="<!--{eval echo register_static('css/bootstrap.min.css');}-->" rel="stylesheet">
        <link href="<!--{eval echo register_static('css/bootstrap-reset.css');}-->" rel="stylesheet">

        <!--Animation css-->
        <link href="<!--{eval echo register_static('css/animate.css');}-->" rel="stylesheet">

        <!--Icon-fonts css-->
        <link href="<!--{eval echo register_static('assets/font-awesome/css/font-awesome.css');}-->" rel="stylesheet" />
        <link href="<!--{eval echo register_static('assets/ionicon/css/ionicons.min.css');}-->" rel="stylesheet" />
        
        <link href="<!--{eval echo register_static('assets/sweet-alert/sweet-alert.min.css');}-->" rel="stylesheet">
        
        <!-- Plugins css -->
        <link href="<!--{eval echo register_static('assets/modal-effect/css/component.css');}-->" rel="stylesheet">

        <!-- DataTables -->
        <link rel="stylesheet" href="<!--{eval echo register_static('assets/datatables/jquery.dataTables.min.css" rel="stylesheet');}-->" />

        <!-- Custom styles for this template -->
        <link href="<!--{eval echo register_static('css/style.css');}-->" rel="stylesheet">
        <link href="<!--{eval echo register_static('css/helper.css');}-->" rel="stylesheet">
        
        <!-- My styles for this template -->
        <link href="<!--{eval echo register_static('css/common.css');}-->" rel="stylesheet">

    </head>

    <body>

        <!-- Aside Start-->
        <!--{template admin_v2/leftside}-->
        <!-- Aside Ends-->


        <!--Main Content Start -->
        <section class="content">
            
            <!-- Header -->
            <!--{template admin_v2/header}-->
            <!-- Header Ends -->


            <!-- Page Content Start -->
            <!-- ================== -->

            <div class="wraper container-fluid diary-topics">
            
            	<div class="row">
                    <div class="col-md-12">
                        <div class="panel panel-default">
                            <div class="panel-heading">
                                <h3 class="panel-title">活动推送</h3>                                
                            </div>                                                                  		                        
                            <div class="panel-body">
                       			  <div class="row">
		                            <div class="col-md-3 col-sm-3 col-xs-3">
		                            <button class="btn btn-primary"  data-toggle="modal" data-target=".bs-example-modal-lg">发推送</button>                                 
		                            <div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true" style="display: none;">
		                                    <div class="modal-dialog modal-lg">
		                                        <div class="modal-content">
		                                            <div class="modal-header">
		                                                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
		                                            	<h4 class="modal-title" id="myLargeModalLabel">发推送</h4>
		                                            </div>
		                                            <div class="modal-body">
		                                             	<div class="row">
		                                             		<div class="col-md-7">
		                                             			<div class=" form">
								                                    <form class="cmxform form-horizontal tasi-form"  id="pushmsg"  novalidate="novalidate">
								                                        <div class="form-group ">
								                                            <label  class="control-label col-lg-2">推送标题</label>
								                                            <div class="col-lg-10">
								                                                <input class=" form-control" id="msg_title" name="push_title" type="text"  aria-required="true">
								                                            </div>
								                                        </div>
								                                        <div class="form-group ">
								                                            <label for="cemail" class="control-label col-lg-2">Tag名称</label>
								                                            <div class="col-lg-10" id="cemail">
								                                               <select name="tag_name" id="tag_name" class="form-control">
																	      			<option >--请选择Tag--</option>
																	      			<option value="ffuser">在线用户</option>
																	      			<option value="unlogin">未登录用户</option>
																	      			<option value="ffrj">安卓用户</option>
																	      			<option value="ffsns">IOS用户</option>
																	      			<option value="4_04">安卓4.04</option>
																	      			<option value="4_01">安卓4.01</option>
																	      			<option value="3_99">安卓3.99</option>
																	      			<option value="chatgroup_300227">逗比团测试</option>
																	      			<option value="test">测试版本调试</option>
						      													</select>
						      													<label class="label label-danger">测试的时候一定要【选测试Tag】！！！</label>
								                                            </div>
								                                        </div>
								                                        <div class="form-group">
								                                            <label  class="control-label col-lg-2">推送内容</label>
								                                            <div class="col-lg-10">
								                                                <textarea class="form-control "  name="push_content" placeholder="40个字符以内" ></textarea>
								                                            </div>
								                                        </div>
								                                        <div class="form-group">
								                                             <label for="push_type" class="control-label col-lg-2">推送类型</label>
								                                             <div class="col-lg-10" id="push_type">
																		     <select name="push_type" class="form-control">
																	      			<option value="push_action">话题(ffweb上的话题链接)</option>
																	      			<option value="push_link" >网页(H5专题页)</option>
																	      			<option value="push_diary_action">日记(ffweb上的日记链接)</option>
																				 	<option value="push_custom">自定义Action(pinksns://开头)</option>
																				 	<!--<option value="push_duiba">兑吧(http://开头)</option>-->
						      												 </select>
						      												 </div>
																		</div>
																		 <div class="form-group">
								                                            <label  class="control-label col-lg-2">推送链接</label>
								                                            <div class="col-lg-10">
								                                                  <input class="form-control"  name="push_url" type="text" placeholder="记得和推送类型对应" >
								                                            </div>
								                                        </div>
								                                        <div class="form-group">
								                                            <div class="col-lg-offset-2 col-lg-10">
								                                            	<input type="hidden" name="ac" value="push_class"/>
								                                            	<input type="hidden" name="op" value="pushActivity"/>
								                            					<button class="btn btn-primary" id="release" type="button">发布</button>
								                                            </div>
								                                        </div>
								                                    </form>
																</div> 
		                                             		</div>
		                                             
		                                             	</div>
		                                            </div>
		                                        </div><!-- /.modal-content -->
		                                    </div><!-- /.modal-dialog -->
		                            </div><!-- /.modal --> 
		                            </div>
		                           	<div class="col-md-9 col-sm-9 col-xs-9">
		                                	<!-- Search -->
										    <form class="form-inline" role="form" action="admin.php" method="get" style="float:right;">			                         
			                                    <div class="form-group">
			                                        <label class="control-label" for="user_id">user_id：</label>
								                    <input class="form-control" value="{$user_id}" name="user_id" id="user_id" type="text" placeholder="user_id" >
			                                    </div>
			                                    <div class="form-group">
			                                        <label  class="control-label" for="channel_id">channel_id：</label>							                        
							                        <input class="form-control" id="channel_id" value="{$channel_id}" name="channel_id" type="text" placeholder="channel_id" >
			                                    </div>
			                                     <div class="form-group">
			                                        <label  class="control-label" for="version">版本选择：</label>		
			                                        <select id="version" name="version" class="form-control">
			                                        	<option <!--{$version_css['channel']}-->   value="channel">安卓版本</option>
			                                        	<option <!--{$version_css['channel1']}-->  value="channel1">ios普通版</option>
			                                        	<option <!--{$version_css['channel2']}-->  value="channel2">ios专业版</option>	
			                                        </select>	
			                                    </div>
			                                   
			                                    <input type="hidden" name="ac" value="push_class">
			                                    <input type="hidden" name="op" value="queryBindList">
			                                    <button type="submit" class="btn btn-success m-l-10">点击查询</button>
			                            
			                                </form>
			                         </div> 
			                    </div> 
                                <br/>
                                <div class="row">
                                    <div class="col-md-12 col-sm-12 col-xs-12">
                                        <table id="datatable" class="table table-striped table-bordered">
                                            <thead>
                                                <tr>
                                                     <th>标签名</th>                                         
                           							 <th>标签信息</th>                                         
                            						 <th>创建时间</th>
                            						 <th>操作</th>  
                                                </tr>
                                            </thead>

                                            <tbody>
                                          			<!--{if !empty($list)}-->
                                           				<!--{loop $list $value}-->
                                           					<tr>
                                           						<td>
                                           							<!--{$value['name']}-->
                                           						</td>
                                           						<td>
                                           							<!--{$value['info']}-->
                                           						</td>
                                           						<td>
                                           							<!--{eval echo date('Y-m-d H:i:s',$value['create_time'])}-->
                                           						</td>
                                           						<td>
                                           							<button id="deleteBlind" data-tagname="{$value['name']}" data-userid="{$user_id}" data-channelid="{$channel_id}" data-version="{$version}"class="btn btn-primary">删除</button>
                                           						</td>
                                           					</tr>
                                           				<!--{/loop}-->
                                           			<!--{/if}-->
                                             </tbody>
                                         </table>
                                    
                                     </div>
                                 </div>
                             </div>
                         </div>
                     </div>
                 </div>

            </div>
            <!-- Page Content Ends -->
            <!-- ================== -->
         
            <!-- Footer Start -->
            <!--{template admin_v2/footer}-->
            <!-- Footer Ends -->



        </section>
        <!-- Main Content Ends -->


        <!-- js placed at the end of the document so the pages load faster -->
        <script src="<!--{eval echo register_static('js/jquery.js');}-->"></script>
        <script src="<!--{eval echo register_static('js/bootstrap.min.js');}-->"></script>
        <script src="<!--{eval echo register_static('js/pace.min.js');}-->"></script>
        <script src="<!--{eval echo register_static('js/wow.min.js');}-->"></script>
        <script src="<!--{eval echo register_static('js/jquery.nicescroll.js');}-->" type="text/javascript"></script>

		<script src="<!--{eval echo register_static('js/jquery.app.js');}-->"></script>

		<script src="<!--{eval echo register_static('layer/layer.js');}-->"></script>
        <script src="<!--{eval echo register_static('assets/datatables/jquery.dataTables.min.js');}-->"></script>
        <script src="<!--{eval echo register_static('assets/datatables/dataTables.bootstrap.js');}-->"></script>
        <script src="<!--{eval echo register_static('assets/sweet-alert/sweet-alert.min.js');}-->"></script>
        <script src="<!--{eval echo register_static('assets/sweet-alert/sweet-alert.init.js');}-->"></script>
        
        <!-- Modal-Effect -->
        <script src="<!--{eval echo register_static('assets/modal-effect/js/classie.js');}-->"></script>
        <script src="<!--{eval echo register_static('assets/modal-effect/js/modalEffects.js');}-->"></script>
        
		<script type="text/javascript">
			$(document).off('click','#release').on('click','#release',function(){
				var data =$("#pushmsg").serialize();
				
				swals(data);
			});
			$(document).off('click','#deleteBlind').on('click','#deleteBlind',function(){
				var data={'ac':'push_class','op':'deleteTag','tagName':$(this).data('tagname'),'user_id':$(this).data('userid'),'channel_id':$(this).data('channelid'),'version':$(this).data('version')};
			
				swals(data);
			});
			var swals = function (data, url, title, text){
				if (url === undefined) {
					url = "admin.php";
				}
				if (title === undefined) {
					title = "确认操作?";
				}
				if (text === undefined) {
					text  = "请慎重操作!";
				}

				swal(
	                		{   
		                		title: title,
		                		text: text,
		                		type: "warning",   
		                		showCancelButton: true,   
		                		confirmButtonColor: "#DD6B55",   
		                		confirmButtonText: "Sure!",   
		                		closeOnConfirm: false 
	                		}, 
	                		function(){
	                			$.ajax(
	                		            {
	                		            	dataType:   "json",
	                		                url     :   url,
	                		                type    :   "GET",
	                		                data    :   data,
	                		                success :   function(data)
	                		                            {
															$('.sweet-alert').hide();
	                		                				if(data==1){
	                		                					swal("操作完成!", "", "success");
	                		                				}else{
	                		                					swal("操作失败!", "", "error"); 
	                		                				}
	                		                				refresh();
	                		                            }
	                		            });
	                		});        	
	            }
	            // 刷新当前页面
	            var refresh=  function (){
					layer.load();
	                setInterval(function(){window.location.reload()},1000);
	            }
        </script>
    </body>
</html>
